/**
 * @找出数组中最小的值
 *
 * @author	 wangshikun <wangshikun2010@gmail.com>
 * @copyright	(c) 2012 wangshikun <wangshikun2010@gmail.com>
 * @license	http://www.opensource.org/licenses/mit-license.php The MIT License
 * @package	default
 * @subpackage	default
 */

#include <stdio.h>
#include <cs50.h>

int minimum (int values[], int number);

int main(int argc, char *argv[]) {
	int array1[5] = {157, -28, -37, 26, 10};
	int array2[7] = {12, 45, 1, 10, 5, 3, 22};
	
	printf("The smallest number in arrry 1: %d\n", minimum (array1, 5));
	printf("The smallest number in arrry 2: %d\n", minimum (array2, 7));

	return 0;
}


int minimum (int values[], int number) {
	int minvalue;

	minvalue = values[0];

	for (int i=1; i<number; i++) {
		if (values[i] < minvalue) {
			minvalue = values[i];
		}
	}

	return minvalue;
}
